
$('#warna').datagrid({
				title:'List Referensi Warna',
				//iconCls:'icon-ok',
				width:'auto',
				height:tinggi-225,
				nowrap: true,
				autoRowHeight: false,
				striped: true,
				collapsible:false,
				singleSelect:true,
				rownumbers:true,
				url: host+'backend/get_data/cl_warna/',
				pagination:"true",
				queryParams:{
					user_id:user_id,
					user_group:user_group
				},
				
			toolbar:[{
						iconCls:'add',
						text:'Tambah',
						id:'add_data', 
						handler:function(){
							get_form(host+'backend/get_crud/cl_warna/add/','',410,140,'Tambah Data Referensi Warna');	
						}
					 },'-',
					 {
						text:'Edit',
						iconCls:'building_edit',
						id:'edit_data',
						handler:function(){
							cek_grid('edit','Edit Data Reseller Produk');
						}
					
					 },'-',
					 {
						text:'Hapus',
						iconCls:'delete',
						handler:function(){
							cek_grid('delete','Hapus Data Reseller Produk');
						}
					 },'-'
				
			],	

				columns:[[
					{field:'ck', checkbox:true},
					{field:'warna' ,title:'Warna', width:450, sortable:true},
					
				]]
});

function cek_grid(tbl,jdl){
		row = $('#warna').datagrid('getSelected');
		if(row){
			if(tbl=='delete'){
				$.messager.confirm('Confirm','Yakin Data Ini Akan Dihapus ?',function(r){  
					if (r==true){  
					  	$.post(host+'backend/hapus/cl_warna',{id:row.id},function(resp){
							if(resp==1){$.messager.alert("Data","Data Sudah Terhapus",'info');$('#warna').datagrid('reload');}		   
						});	
					}  
				}); 
			}
			else if(tbl=='edit'){
				get_form(host+'backend/get_crud/cl_warna/'+tbl+'/'+row.id+'_'+row.warna,'',410,140,jdl);
				//get_form(host+'modul/get_form/add_produk/'+tbl+'/'+row.id_produk); 
			}
			
			
		}
		else{$.messager.alert("Data","Pilih Salah Satu Data",'error');}
}